<template>
  <div>
    <HeaderBar :currentName="_t18('sidebar_jifen', ['aams', 'robinhood2'])"></HeaderBar>

    <div style="padding: 0 0.4rem">
<!--        <div style="background:#ffbe40;padding:10% 5%;border-radius: 14px">-->

<!--        </div>-->
      <div class="jifen">
        <div>
          我的积分 ： <span style="font-weight: bold">{{userStore.userInfo.user.points || 0}}</span>
        </div>
<!--        <div style="font-size: 14px;color: #ffbe40">-->
<!--          获取记录-->
<!--        </div>-->

      </div>
      <div class="jifen_button">
        <div @click="routeLink('/exchange')">
          兑换商品
        </div>
          <div @click="routeLink('/plug')">
            赚取积分
          </div>
      </div>
      <div style="font-size: 18px;font-weight: bold;margin-top: 5%">
        积分明细
      </div>
      <div v-for="item in list" class="list">
        <div style="display: flex;justify-content: space-between">
          <div style="font-weight: bold;font-size: 16px">
<!--            {{item.operType}}-->
            {{item.operTypeZh == '登记'?'奖励':item.operTypeZh}}
          </div>
          <div style="font-weight: bold;font-size: 14px">
           {{item.operPoint}}
          </div>
        </div>
        <div style="color: #aeadb2;margin-top: 2%">
          {{item.remark}}
        </div>
        <div style="color: #aeadb2;margin-top: 2%">
          {{item.createTime}}
        </div>
      </div>
      <Nodata v-if="list.length == 0"></Nodata>
    </div>
  </div>
</template>
<script setup>
import {useRouter} from "vue-router";
import { useUserStore } from '@/store/user/index'
const userStore = useUserStore()
const $router = useRouter()
import {_t18} from "@/utils/public";
import {getwalletRecordlist} from "@/api/trade";
import {getpointsList} from "@/api/defi";
// 撤单
const list = ref([])
const cancelOrder = async () => {

  const res = await getpointsList({})
  list.value = res.rows
}
const routeLink = (link) => {
  $router.push(link)
}
onMounted(() => {
  cancelOrder()
})

</script>
<style scoped lang="scss">
.jifen{
  display:flex;justify-content: space-between;
  font-size: 14px;
  margin-top: 5%;
  align-items: center;
}
.list{
  margin-top: 5%;border-bottom: 1px solid #ddd;padding-bottom: 5%
}
.jifen_button{
  display:flex;
  align-items: center;
  font-size: 12px;
}
.jifen_button div{
  background: #ffbe40;
  padding: 2% 8%;
  border-radius: 14px;
  color: #fff;
  margin-top: 5%;
}
.jifen_button :nth-child(2){
margin-left: 5%;
}
</style>
